package com.romotc.common.utils;

import org.apache.commons.lang.math.RandomUtils;

public class RandomPswd {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		for (int i = 0; i < 1000; i++) {
			System.out.println(getSimplePswd(6,8));
//			System.out.println(RandomUtils.nextInt(5));
		}

	}

	/**
	 * 获取简单密码
	 * @param minLen 密码最小长度
	 * @param maxLen 密码最大长度
	 * @return
	 */
	public static String getSimplePswd(int minLen, int maxLen) {
		int len = RandomUtils.nextInt(maxLen) + 1;
		len = len < minLen ? minLen : len;
		String tmp = "";
		String pswd = "";
		for(int i = 0;;i++,i++) {
			tmp = RandomString1.randomString(1);
			pswd += tmp + tmp;
			if(pswd.length() >= len)
				break;
		}
		if(pswd.length() > len) {
			pswd = pswd.substring(0, len);
		}
		return pswd;
	}
}
